<?php

use App\Http\Controllers\Auth\UserController;
use App\Http\Controllers\Notes\NotesController;
use App\Http\Controllers\Plan\PlanController;
use App\Http\Controllers\Target\TargetController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});
Route::prefix('user')->controller(UserController::class)->group(function () {

    Route::post('login', 'login');

    Route::post('wxLogin', 'wxLogin');

    Route::middleware('auth:sanctum')->group(function () {

    });
});

Route::prefix('notes')->controller(NotesController::class)->middleware('auth:sanctum')->group(function () {
    //笔记分类
    Route::get('classify', 'notesClassify');
    //添加笔记
    Route::post('create_node', 'addNotes');
    //列表
    Route::get('note_list', 'noteList');
    //删除笔记
    Route::post('del_note', 'delNotes');
    //笔记详情
    Route::get('note_info', 'noteDetail');
});

Route::prefix('target')->controller(TargetController::class)->middleware('auth:sanctum')->group(function () {
    //目标分类
    Route::get('target_classify', 'targetClassify');
    //目标类型
    Route::get('target_type', 'targetType');
    //创建
    Route::post('create_target', 'createTarget');
    //目标列表
    Route::get('target_list', 'targetList');
    //删除目标
    Route::post('del_target', 'delTarget');
    //目标详情
    Route::get('target_info', 'detailTarget');
});

Route::prefix('plan')->controller(PlanController::class)->middleware('auth:sanctum')->group(function () {
    //创建待办事项
    Route::post('create', 'createPlan');
    //列表
    Route::get('list', 'planList');
    //待办事项提交到已完成
    Route::post('complete', 'completePlan');
    //删除
    Route::post('del_plan', 'delPlan');
});
